from lib.webui_permission import  *
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from hyrobot.common import CHECK_POINT, STEP

class c73304:
    name = '验证退出功能-c73304' # 测试用例名字

# 初始化方法
    def setup(self):
        STEP(1, '登陆网站')
        driver = open_browser()
        user_login(driver)

    #清除方法
    def teardown(self):
        driver = get_global_webdriver()
        driver.quit()

    # 测试用例步骤
    def teststeps(self):
        # 获取webdriver对象 对应 已经登录好的浏览器
        driver = get_global_webdriver()
        time.sleep(3)
        # .avatar - wrapper > span
        driver.find_element(By.CSS_SELECTOR,
        ".avatar-wrapper > span:nth-child(1)").click()
        
        time.sleep(3)
        logout = driver.find_element(By.CSS_SELECTOR,
        "li.el-dropdown-menu__item:nth-child(2) > span:nth-child(1)").click()

        get_title = driver.find_element(By.CSS_SELECTOR, "#app > div > form > div.title-container > h3").text
        expect_title = "Kylin客户服务平台"
        CHECK_POINT("登录界面标题与预期是否一致", get_title == expect_title)

